<?php

namespace app\api\model\xykeep;

use think\Model;
use traits\model\SoftDelete;
class Take extends Model
{
    use SoftDelete;



    // 表名
    protected $name = 'xykeep_take';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';


    protected function base($query)
    {
        $query->where(['deletetime'=>null])->order('id desc,weigh desc');
    }

    public function user()
    {
        return $this->belongsTo('app\admin\model\xykeep\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
